'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 9_str_output_parser.py
* @Time: 2025/10/22
* @All Rights Reserve By Brtc
'''
import dotenv
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI

dotenv.load_dotenv()

#1、构建prompt
prompt = ChatPromptTemplate.from_template("{query}")
#2、构建大模型
llm = ChatOpenAI(model = "gpt-4o-mini")
parser = StrOutputParser()
content = parser.invoke(llm.invoke(prompt.invoke({"query":"你好你是？"})))
print(content)